import Layout from "@/layout/Index.vue";
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: Layout,
        hidden: true,
        meta: {
            title: '牛马系统'
        },
        // redirect: '/index',
        children: [
            {
                path: '/',
                name: 'Index',
                meta: { title: '主页'},
                component: () => import('@/views/Index.vue'),
            },
            {
                path: '/HelloWorld',
                name: 'HelloWorld',
                meta: { title: 'HelloWorld'},
                component: () => import('@/views/components/HelloWorld.vue')
            },
            {
                path: '/parent',
                name: 'Parent',
                meta: { title: 'Parent'},
                component: () => import('@/views/components/Parent.vue')
            },
            {
                path: '/child',
                name: 'Child',
                meta: { title: 'Child'},
                component: () => import('@/views/components/Children.vue'),
                hidden: true
            },
            {
                path: '/basicAMap',
                name: 'BasicAMap',
                meta: { title: '高德地图'},
                component: () => import('@/views/amap/basicAMap.vue'),
            },
            {
                path: '/basicBMap',
                name: 'BasicBMap',
                meta: { title: '百度地图'},
                component: () => import('@/views/bmap/basicBMap.vue'),
            },
        ]
    },
]

// 路由 mode 模式：history 和 hash
const router = createRouter({
    // history: createWebHistory(),     // history：路由中不含 `#`
    history: createWebHashHistory(),    // hash：路由中附带 `#`
    routes
})

export default router